package shiyan6;

public class Task02Test {

    private static final int ITERATIONS = 10;
    private static final long SLEEP_MILLIS = 50L;

    public static void main(String[] args) {
        YiXinZhiRunnable runnable = new YiXinZhiRunnable();
        Thread worker = new Thread(runnable, "YiXinZhi1429");
        worker.start();

        for (int i = 0; i < ITERATIONS; i++) {
            System.out.println(Thread.currentThread().getName() + " 正在执行：主线程运行中...");
            try {
                Thread.sleep(SLEEP_MILLIS);
            } catch (InterruptedException e) {
                Thread.currentThread().interrupt();
                System.err.println("主线程被中断：" + e.getMessage());
                break;
            }
        }
    }
}
